class Student {
  String id;
  String name;
  int score;
  Student({
    required this.id,
    required this.name,
    required this.score,
  });

  //用于将JSON字典转换成类对象的工厂类方法
  factory Student.fromJson(Map parsedJson) {
    return Student(
      id: parsedJson['id'],
      name: parsedJson['name'],
      score: parsedJson['score'],
    );
  }

  //将类对象转换成JSON字典，方便插入数据库
  Map toJson() {
    return {
      'id': id,
      'name': name,
      'score': score,
    };
  }
}
